package UILayer;

import ControllerLayer.CustomerCtr;
import ControllerLayer.EmployeeCtr;
import ControllerLayer.ItemCtr;
import ModelLayer.*;

public class Demo {
    private MainUI mainUI = new MainUI();
    private CustomerCtr cCtr = new CustomerCtr();
    private EmployeeCtr eCtr = new EmployeeCtr();
    private ItemCtr iCtr = new ItemCtr();
    private SupplierCon supplierCon = SupplierCon.getInstance();

    public Demo(){
    	try{
			cCtr.createCustomer("Store Knud", "Havnen 1", "sknud@gmail.com", "12345678");
			cCtr.createCustomer("Lille Johann", "Bakken 2", "ljoh@gmail.com", "23658974");
		}
		catch (Exception e){
			System.out.println(e);
		}
		
		try{
			eCtr.createEmployee("Lotte Lamelle", "Byvej 2", "llam@gmail.com", "25896314");
			eCtr.createEmployee("Hans Hansen", "Skovlund 3", "hh@gmail.com", "14785236");
		}
		catch (Exception e){
			System.out.println(e);
		}
		
        eCtr.getEmployee(1).setPassword("1234");
        eCtr.getEmployee(2).setPassword("1234");

        Supplier s1 = new Supplier("Bosch");
        Supplier s2 = new Supplier("Heavy Tools");
        Supplier s3 = new Supplier("Treefactory");
        Supplier s4 = new Supplier("Sanni Sanitaire");
        supplierCon.addSupplier(s1);
        supplierCon.addSupplier(s2);
        supplierCon.addSupplier(s3);
        supplierCon.addSupplier(s4);

        try {
        	iCtr.createProduct("sav", "Stor sav", 1, 10, 100, 2, 2);
            iCtr.createProduct("Bosch 111", "Boremaskine", 1, 30, 500, 2, 2);
            iCtr.createProduct("Havetraktor1000", "Stor Heavy Tools havetraktor", 2, 1, 10000, 2, 2);
            iCtr.createProduct("Mdf plade", "Mdf plade 100 mm", 3, 100, 100, 2, 2);
            iCtr.createProduct("Vask", "Stål håndvask", 4, 10, 1500, 2, 2);
            iCtr.createProduct("Fiskekage", "Lækker kage", 4, 10, 100, 2, 2);
        }
        catch (Exception e){
        	System.out.println(e);
        }
        
        try {
            iCtr.setProductPrice((Product)iCtr.retrieveItem(1), 199.95, 1500);
            iCtr.setProductPrice((Product)iCtr.retrieveItem(2), 250, 6000);
            iCtr.setProductPrice((Product)iCtr.retrieveItem(3), 26500, 26500);
            iCtr.setProductPrice((Product)iCtr.retrieveItem(4), 199.95, 15000);
            iCtr.setProductPrice((Product)iCtr.retrieveItem(5), 749.95, 7000);
            iCtr.setProductPrice((Product)iCtr.retrieveItem(6), 25, 230);
        }
        catch (Exception e){
        }
        mainUI.startLogIn();
    }

}
